import { Button, VerticalBox, HorizontalBox, LineEdit } from "std-widgets.slint";

export component AppWindow inherits Window {
    preferred-width: 300px;
    preferred-height: 200px;
    title: "创建序列文件夹";
    icon: @image-url("FluentFolderAdd48Regular.png");
    default-font-family: "WenQuanYi Micro Hei";
    default-font-size: 16px;
    
    forward-focus: folder_field;
    in-out property <string> folder-name <=> folder_field.text;
    in-out property <int> queue-number;
    in-out property <string> tip;

    callback hello(string);
    callback assemble-folder-name();
    callback mkdir();

    VerticalBox {
        alignment: start;
        HorizontalBox {
            folder_field := LineEdit {
                placeholder-text: "输入名称";
                accepted => {
                    mkdir();
                }
                edited => {
                    assemble-folder-name();
                }
            }
            Button {
                text: "创建";
                clicked => {
                    mkdir();
                }
            }
        }
        VerticalBox {
            Text {
                font-size: 20px;
                text: queue-number + "_" + folder-name;
                wrap: word-wrap;
                overflow: TextOverflow.clip;
                min-height: 120px;
            }
            Text {
                font-size: 16px;
                text: tip;
            }
        }
    }
}
